package by.averianov.discounta.webapp.page.user.userdetails;

import org.apache.wicket.AttributeModifier;
import org.apache.wicket.Page;
import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow.PageCreator;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.link.Link;
import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.Model;

import by.averianov.discounta.datamodel.UserAccount;
import by.averianov.discounta.webapp.page.homepage.HomePage;
import by.averianov.discounta.webapp.page.user.UserProfilePage;

public class UserDetailsPanel extends Panel {
	
	private UserAccount account;
	private boolean isLast;
	
	public UserDetailsPanel(String id, UserAccount account, boolean isLast) {
		super(id);
		this.account = account;
		this.isLast = isLast;
		
	}

	@Override
	protected void onInitialize() {
		super.onInitialize();
		WebMarkupContainer liContainer = new WebMarkupContainer("tooplate_fp_services");
		if (isLast) {
			liContainer.add(AttributeModifier.append("class", "last"));
		}
		add(liContainer);

		WebMarkupContainer hContaienr = new WebMarkupContainer("fp_services_box");
		liContainer.add(hContaienr);

		hContaienr.add(new Label("email", new Model<String>(account.getUserEmail())));
		liContainer.add(new Label("idAccount", new Model<Long>(account.getId())));
		liContainer.add(new Label("priceWithoutModel", new Model<Boolean>(account.getUserStatus())));

		liContainer.add(new Link<Void>("linkTodetails") {

			@Override
			public void onClick() {
				/*setResponsePage(new UserStatusPage(account, new PageCreator() {

					@Override
					public Page createPage() {
						return new HomePage();
					}
				}));*/
			}
		});
	}

}
